<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <table border="1px" style="text-align: center;">
        <thead>
            <tr>
                <td>名字</td>
                <td>年龄</td>
            </tr>
        </thead>
        <tbody></tbody>
    </table>
    <!-- //引入jquery -->
    <script src="./node_modules/jquery/dist/jquery.js"></script>
    <script>
        //获取全部数据
        function apply() {
            $.ajax({
                type: "GET",
                url: "http://127.0.0.1:3000/userslist/getdatalist",
                success: (a) => {
                    a.result.forEach(item => {
                        $("tbody").append(`
                          <tr>
                <td>${item.name}</td>
                <td>${item.age}</td>
            </tr>
                        `)
                    });
                },
                error: (e) => {
                    console.log(e);
                }
            })
        }
        apply()
    </script>
</body>

</html>